<!DOCTYPE html>
<html>
  <head>
    <title>用户登录</title>
	<meta charset="utf-8">
    <link href="/stylesheets/bootstrap.min.css" rel="stylesheet" media="screen">
      <script src="/javascripts/jquery-2.1.1.min.js" type="text/javascript"></script>
      <script src="/javascripts/bootstrap.min.js" type="text/javascript"></script>
		<style type="text/css">
			.panel-body{
				padding: 30px 50px 0 50px;
			}
			.form-group{
				margin-bottom: 35px;
			}
			.panel-title{
				font-size: 24px;
				font-weight: bold;
			}
		</style>
        <script type="text/javascript">
           function login(){
               var username = $('#username').val(),password = $('#password').val();
               var data = { "uname": username, "upwd":password};
               $.ajax({
                   url:'/login',
                   type:'POST',
                   data:data,
                   success:function(data,status){
                       if(status == 'success'){
                           location.href='/home';
                       }
                   },
                   error:function(data,status){
                     if(status == "error"){
                         location.href='/login'
                     }
                   }
               });
           }
        </script>
  </head>
<body>
<div class="container web-body" style="margin-top:100px;width: 900px;">
    <div class="row">
        <div class="col-lg-6 col-lg-offset-3">
            <div class="panel panel-default">
                <div class="panel-heading" style="height: 50px;">
                    <div class="panel-title" style="text-align: left">用户登录</div>
                </div>
                <div class="panel-body">
                    <form action="#" class="form-horizontal" role="form" method="post" >
                        <div class="form-group">
                            <input id="username" value="admin" type="text" class="form-control" name="username" placeholder="用户名" />
                        </div>
                        <div class="form-group">
                            <input id="password" value="1" type="password" class="form-control" name="password" autocomplete="off" placeholder="密码" />
                        </div>
                        <div class="form-group">
                            <input type="button" class="btn btn-success btn-block" onclick="login();" value="登 陆" />
                            <a href="register" class="btn btn-primary" style="float: right;margin-top: 20px;">注 册</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>


